<?php
defined('_JEXEC') or die('Restricted access');
$auc_id = JRequest::getVar('auc_id');
$db = JFactory::getDBO();
if(!JRequest::getVar('user_id')){
	$query = "SELECT au.*, u.profile_number FROM #__auction_user as au LEFT JOIN #__users as u ON au.user_id = u.id WHERE au.auction_id = ". $auc_id." ORDER BY id DESC LIMIT 0,5";
} else {
	$query = "SELECT au.*, u.profile_number FROM #__auction_user as au LEFT JOIN #__users as u ON au.user_id = u.id WHERE au.auction_id = ". $auc_id." AND au.user_id = ".JRequest::getVar('user_id')." ORDER BY id DESC LIMIT 0,5";
}
$db->setQuery($query);
$aucs = $db->loadObjectList();
?>
<link rel="stylesheet" type="text/css" media="screen" href="templates/tpl_automobil/css/style.css" />
<style>
body{
	background:transparent;
}
td{
	text-align:center;
}
</style>
<?php 
if(!$aucs){
	echo "Ingen tilbudsgiver";
} else {
?>
<table class="boder" width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td width="15%" class="bg_dark_gray"><strong>Profil-nr.</strong></td>
    <td width="18%" align="center" class="bg_dark_gray"><strong>Bud dato</strong></td>
    <td width="16%" align="center" class="bg_dark_gray"><strong>Seneste Bud</strong></td>
    </tr>
     <?php
	foreach($aucs as $auc){
		$tmp = explode(' ',$auc->aucdate);
		$tmp1 = explode('-', $tmp[0]);
		$date = $tmp1[2].'-'.$tmp1[1].'-'.$tmp1[0];
	?>
    <tr>
    <td align="center" class="boder_t"><?php echo $auc->profile_number;?></td>
    <td align="center" class="boder_l boder_t"><?php echo $date;?></td>
    <td align="center" class="boder_l boder_t"><?php echo number_format($auc->price,0,',','.');?>,- DKK</td>
    </tr>
   <?php $i++;}?>
</table>
<?php }?>